/**
 * 注册自定义指令
 * status === 0 不进行注册
 */
import { upperFirst, camelCase } from 'lodash'
const directivePlugin = {
    install(app){
        const plugins = require.context('./module', true, /\.(js)$/)
        plugins.keys().forEach(fileName => {
            const pluginsConfig = plugins(fileName)
            const option = pluginsConfig.default
            const name = camelCase(option && option.name || fileName .split('/') .pop() .replace(/\.\w+$/, ''))
            if(pluginsConfig.status !== 0){
                app.directive(name, option)
            }
            // console.log(name, option)
        })
        // app.directive('auth', directive.auth)
    }
}

export default directivePlugin